from tool.vector import Vector


# class Prop:
#     def __init__(self, name: str, xywh: [float]):
#         # logo.Mlog.logger.debug(float(xywh[0]))
#         self.name = name
#         self.pot = Vector(float(xywh[0]), float(xywh[1]))
#         self.wh = Vector(float(xywh[2]), float(xywh[3]))
#
#     name: str
#     pot: Vector
#     wh: Vector
    # def __hash__(self):


class Prop:
    def __init__(self, name: str, xywh: list[float]):
        self.name = name
        self.x = float(xywh[0])
        self.y = float(xywh[1])
        self.w = float(xywh[2])
        self.h = float(xywh[3])
        self.black = False

    def getPot(self) -> Vector:
        return Vector(self.x, self.y)

    def getWH(self) -> Vector:
        return Vector(self.w, self.h)

    def to_dict(self):
        return {
            "name": self.name,
            "x": self.x,
            "y": self.y,
            "w": self.w,
            "h": self.h,
            "black": self.black
        }
